#include "plane.h"

plane::plane()
{
	__x = (WINDOW_WIDTH - SIZEOF_MYPLANE) / 2;
	__y = WINDOW_WIDTH - SIZEOF_MYPLANE;
	blood = MAX_HIT_POINT;
	energy = MAX_MAMA_POINT;
	bullet_num = 0;
	last_bullet = 0;
}
plane::plane(int x, int y, int b, int e) : object(x, y, b)
{
	energy = e;
}
void plane::createbullet()
{
	if (bullet_num < MAX_BULLET_NUM)
	{
		bullet_num++;
		bullets[(last_bullet + 1) % MAX_BULLET_NUM] = bullet(__x, __y);
	}
}

void plane::movebullet()
{
	for (int i = 0; i < MAX_BULLET_NUM; i++)
	{
		if (bullets[i].ifsafe())
			bullets[i].move(0, SPEED);
	}
}